﻿#ifndef SCRIPTITEMTREE_H
#define SCRIPTITEMTREE_H

#include <QTreeWidget>
#include<QTableWidgetItem>
#include "notify.h"
#include <QMouseEvent>
#include <QMenu>
#include "commontreedelegate.h"
#include "taskmanager.h"
#include "taskstyleeditor.h"
#include"taskitem.h"
#include<QString>
#include<QSettings>
#include<QDir>
#include<QDebug>
class TaskItem;
/**
 * @brief The ScriptItemTree class 脚本树状视图，分为指令和脚本两级，指令按照开始时间排序
 */
class ScriptItemTree : public QTreeWidget,public Notify
{
    Q_OBJECT
public:
    explicit ScriptItemTree(QWidget *parent = 0);

signals:
    void sig_updateTask(QString , QString, QString);
    void sig_selectCommand(QString);

public slots:

    // Notify interface
public:
    void updateTask(const QString &taskObj, const QString &cmdObj, const QString &scriptObj);
    void commandSelect(const QString &cmdObj);
    void removeTask(const QString &sTaskObj);

    // QWidget interface
protected:
    void mousePressEvent(QMouseEvent *);

private slots:
    void slot_sortCommand();
    void slot_ForwardToAlign();
    void slot_5ForwardToAlign();
    void slot_autoPlan();
    void slot_editStyle();

private:
    QTreeWidgetItem* isExistTopItem(QString sItemText,int role = Qt::WhatsThisRole);
    QTreeWidgetItem* getChildTreeItem(QTreeWidgetItem * parent,QString sItemText,int role = Qt::WhatsThisRole);
    //指令冲突检查报错提示函数-
    void scriptCheck();

    //自动补充冷空观测
    bool autoPlansPaceScan();
};

#endif // SCRIPTITEMTREE_H
